<template>
    <view>
        <view class="switch_box" :style="{ backgroundImage: `url( ${baseUrl}/uploads/uniapp_image/staff/weitu01.png)` }">
            <!-- 切换盒子 -->
            <view class="chop" @tap="SelectItem">
                <view class="spill">虚位以待<image :src="`${baseUrl}/uploads/uniapp_image/staff/xuanze.png`" mode="scaleToFill" /></view>
            </view>
            <!-- 这里因为有多个样式 所以我留下一个 slot插槽 如果有特殊样式 则在使用此组件的地方加入自己的结构 默认slot不传 如果传入slot为true 则代表启用插槽 slogan盒子 和 date_box 不会渲染  -->
            <!-- 标语 -->
            <view class="slogan" v-if="slogan"> 弘扬社会公平,共建社会和谐 </view>
            <!-- 时间 && 班次 -->
            <view class="date_box" v-if="date">
                <view class="date">
                    <uni-datetime-picker type="daterange" @change="Getdate" :clear-icon="false" v-model="single" />
                    <image :src="`${baseUrl}/uploads/uniapp_image/staff/jiao_01.png`" mode="scaleToFill" />
                </view>
                <view class="all" @tap="all">
                    全部班次
                    <image :src="`${baseUrl}/uploads/uniapp_image/staff/jiao_02.png`" mode="scaleToFill" />
                </view>
            </view>
            <!-- 插槽 -->
            <slot v-if="Aslot" />
        </view>
    </view>
</template>

<script setup>
    import { onLoad,onUnload  } from "@dcloudio/uni-app";
    import { computed, reactive, ref } from "vue";
    import { baseUrl } from '@/sheep/config';
    const props = defineProps({
        // 标语 默认为 关
        slogan:{
            type:String,
            default:false
        },
        // 时间 && 班次
        date:{
            type:String,
            default:false
        },
        // 插槽
        Aslot:{
            type:String,
            default:false
        }
    })
    // const emits = defineEmits(['netWork','leftNetWork','rightNetWork']);

    // const trigger = () => {
    //     emits('netWork')
    // }

    // 左侧按钮事件
    // const leftTrigger = () => {
    //     emits('leftNetWork')
    // }

    // 右侧按钮事件
    // const rightTrigger = () => {
    //     emits('rightNetWork')
    // }
</script>

<style scoped lang="scss">
    page {
        // width: 100%;
        height: 100%;
        position: relative;
    }

    .switch_box {
        margin-top: 20rpx;
        background-size: 100%;
        width: 100%;
        height: 182rpx;
        background-repeat: no-repeat;
        color: $uni-text-color;
        margin-bottom: 20rpx;
    }

    // 切换盒子
    .chop {
        width: calc(100% - 80rpx);
        height: 56rpx;
        font-size: 40rpx;
        font-weight: 700;
        padding: 40rpx 40rpx 0 40rpx;
        display: flex;
        align-items: center;
        // 项目标题超出隐藏
        .spill {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            width: 100%;
            image {
                width: 26rpx;
                height: 26rpx;
                margin-left: 14rpx;
            }
        }
    }

    // 标语
    .slogan {
        font-family: PingFangSC;
        color: $uni-text-color;
        font-weight: 700;
       font-size:$uni-font-size-26;
        font-style: normal;
        text-decoration: none;
        text-align: left;
        margin-top: 12rpx;
        margin-left: 40rpx;
        letter-spacing: 0.5rpx; /* 设置字母间距为0.5像素 */
    }

    // 时间 && 班次
    .date_box {
        display: flex;
        width: 100%;

        .date {
            display: flex;
            height: 100%;
            width: 410rpx;
            color: $uni-color-primary;
            font-weight: $uni-font-weight;
           font-size:$uni-font-size-26;
            padding: 12rpx 0 0 40rpx;
            position: relative;

            image {
                position: absolute;
                right: -10rpx;
                bottom: 30%;
                width: 10rpx;
                height: 10rpx;
            }
        }

        .all {
            height: 36rpx;
            color: $uni-text-color;
            font-weight: $uni-font-weight;
           font-size:$uni-font-size-26;
            padding: 23rpx 0 0 62rpx;

            image {
                width: 10rpx;
                height: 10rpx;
            }
        }
    }
</style>